<template>
  <detail-page>
    <template #abBtn>
      <el-button v-if="pageData.dataStatus" type="primary" @click="goRecord">
        产权信息变更记录
      </el-button>
    </template>
    <template #top>
      <info-header id="basic" title="工会基本信息"></info-header>
      <pub-detail-description
        :ndColumn="3"
        :data="pageData"
        :columns="basic"
      ></pub-detail-description>
      <info-header id="land" class="mt-5px" title="土地信息"></info-header>
      <pub-detail-description
        :ndColumn="3"
        :data="pageData"
        :columns="land"
      ></pub-detail-description>
   
      <info-header id="basic" class="mt-5px" title="附件信息"></info-header>
      <pub-detail-description
        :ndColumn="3"
        :data="pageData"
        :columns="files"
      ></pub-detail-description>
    </template>
    <template #bottom>
      <el-button @click="emit('close')" type="primary">关闭</el-button>
    </template>
  </detail-page>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import { formatValue } from '@/utils/index'
// import { assetsDetailOrDelete } from '@/api/cqxxgl.js'
const loading = ref(false)
const route = useRoute()
const router = useRouter()
const emit = defineEmits(['close'])
const pageData = ref({})

const basic = [
  { prop: 'orgName', label: '单位名称', span: 3 },
  { prop: 'organization', label: '组织机构', span: 1 },
  { prop: 'buildDate', label: '成立日期', span: 1 },
  { prop: 'contactPerson', label: '联系人', span: 1 },
  { prop: 'contactPhone', label: '联系电话', span: 2 },
  { prop: 'assetCard', label: '工会资产登记证号', span: 2 },
  { prop: 'receivePerson', label: '领证办理人', span: 2 },
  { prop: 'grantPerson', label: '发证办理人', span: 2 },
  { prop: 'registerPerson', label: '登记人', span: 2 },
  { prop: 'registerDate', label: '登记日期', span: 2 }
]

const land = [
  { prop: 'landCoverArea', label: '占地面积（m²）', type: 'money', span: 3 },
  {
    prop: 'landCertificationArea',
    label: '已办证面积（m²）',
    type: 'money',
    span: 1
  },
  {
    prop: 'landCommonAllocationArea',
    label: '公用分摊面积(m²)',
    type: 'money',
    span: 1
  },
  { prop: 'landLocation', label: '所在位置', span: 3 },
  {
    prop: 'landNature',
    label: '土地性质',
    span: 1,
    type: 'dict',
    dictCode: 'TDXZ'
  },
  { prop: 'landPurpose', label: '用途', span: 2 },
  { prop: 'remark', label: '备注', span: 3 }
]

const files = [
  {
    prop: 'certificationMaterial',
    label: '办证情况说明',
    span: 3,
    type: 'file'
  },
  {
    prop: 'propertyMaterial',
    label: '产权证（土地、房屋）',
    span: 3,
    type: 'file'
  },
  { prop: 'landBuildingMaterial', label: '土地建筑物', span: 3, type: 'file' },
  {
    prop: 'otherMaterial',
    label: '其他附件材料',
    type: 'file',
    span: 3
  }
]

const initAssets = async () => {
  // loading.value = true
  // try {
  //   const res = await assetsDetailOrDelete(route.query.id, 'get')
  //   if (res.data) {
  //     pageData.value = res.data
  //   }
  //   loading.value = false
  // } catch (error) {
  //   loading.value = false
  // }
}

const goRecord = () => {
  router.push({
    path: '/layout/ZCCQGL/CQXXGL/CQXXDJ/CQXXDJ-record',
    query: {
      id: route.query.id
    }
  })
}
const ruleFormRef = ref()

onMounted(() => {
  if (route.query.id) {
    initAssets()
  }
})
</script>

<style scoped lang="scss">

</style>
